/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#include "stdafx.h"
#include "Bullet对外接口.h"

#include "C_物体管理/S_PhysicsBullet.h"


S_Physics* f_创建Bullet物理引擎() {
	return new S_PhysicsBullet();
}

S_物理几何体* f_Bullet平面几何体(const vec4& v) {
	return new S_Bulle平面(v);
}

S_物理几何体* f_Bullet长方体几何体(const vec3& v) {
	return new S_Bullet长方体几何体(v);
}
S_物理几何体* f_Bullet球体几何体(const float32 半径) {
	return new S_Bullet球体几何体(半径);
}
S_物理几何体* f_Bullet凸壳几何体(const S_三角Mesh mesh) {
	return new S_Bullet凸包几何体(mesh);
}

S_物理几何体* f_Bullet网格几何体(const S_三角Mesh mesh) {
	return new S_Bullet网格几何体(mesh);
}


void f_Bullet_创建几何体(S_物理几何体* 几何体, E_物理几何体类型 type) {
	if (几何体->m_绑定内置物体) {
		
	}

	switch (type) {
	case E_碰撞几何_方体:
		break;
	case E_碰撞几何_圆柱:
		break;
	case E_碰撞几何_球体:
		break;
	case E_碰撞几何_胶囊:
		break;
	case E_碰撞几何_凸壳:
		break;
	case E_碰撞几何_平面:
		break;
	case E_碰撞几何_网格:
		break;
	case E_碰撞几何_地形:
		break;
	default:
		break;
	}
}



S_物理体* f_Bullet刚体(S_物理几何体& geom, S_物理材质* mat) {


	return new S_Bullet刚体(geom, mat);
}
S_物理体* f_Bullet静态(S_物理几何体& geom, S_物理材质& mat) {
	return new S_Bullet静态碰撞(geom, mat);
}

S_物理体* f_Bullet控制(S_物理几何体& geom, S_物理材质& mat) {
	return new S_Bullet控制(geom, mat);
	return nullptr;
}

S_物理体* f_Bullet创建车(S_Physics* 解算器, S_车体参数& 车体参数) {
	auto& Core = dynamic_cast<S_PhysicsBullet*>(解算器)->m_Core;
	return new S_Bullet车(Core, 车体参数);
	return nullptr;
}

车辆容器_t f_getBullet车辆(S_Physics* 解算器) {
	车辆容器_t car;
	auto& c = dynamic_cast<S_PhysicsBullet*>(解算器)->m_车;
	car.assign(c.begin(), c.end());
	return car;
}

void f_Bullet_添加物理体(S_Physics* phy, std::vector<S_物理体*> bodys){
	S_PhysicsBullet* bullet = static_cast<S_PhysicsBullet*>(phy);
	auto& Core = dynamic_cast<S_PhysicsBullet*>(phy)->m_Core;

	for (auto& e : bullet->m_刚体) {
		//Core.m_物理域空间[0]->removeRigidBody(e->m_刚体);
	}
	
	//phy->f_添加物理体(body, 0);
}

//btHinge2Constraint




